<style lang="scss" scoped>
	.content {
		width: 100%;
		background-color: white;

		padding: 30rpx 25rpx;
	}

	scroll-view {
		width: 100%;
	}

	.box {
		width: 100%;
		padding: 50rpx 20rpx;
		line-height: 60rpx;
	}

	.u-node {
		width: 14rpx;
		height: 14rpx;
		opacity: 1;
		background: #409eff;
		border-radius: 50%;
	}


	.box2 {
		transform: translateY(-10rpx);
	}

	.line {
		width: 100%;

		.f28 {
			width: 50%;
		}
	}
</style>

<template>
	<view class="content">
		<view class="f34 bold" style="padding:0 30rpx;border-bottom: 1px solid #ccc;padding-bottom: 20rpx;">{{title}}
		</view>
		<scroll-view scroll-y="true" style="height:70vh">
			<view class="box">
				<u-time-line>
					<u-time-line-item v-for="item,index in list" :key="index">
						<!-- 此处自定义了左边内容，用一个图标替代 -->
						<template v-slot:node>
							<view class="u-node">

							</view>
						</template>
						<template v-slot:content>
							<view class="box2" >
								<view class="textColor">任务名称：{{item.taskName}}</view>
								<view class="gray f28">{{item.processTime}}</view>
								<view class="textColor">{{item.createUser | user}}</view>

								<view class="textColor">{{item.processType | taskType}}</view>
								<view class="textColor" v-if="item.explan">说明：{{item.explan?item.explan:'无'}}</view>
								<view class="textColor" v-if="item.transferUser">转交给{{item.transferUser | users}}</view>
								<view class="textColor" v-if="item.compRate">
									进度{{item.compRate?item.compRate+'%':'0.00%'}}</view>


							</view>
							<!-- <view class="box2" v-else-if="type==2">
								<view class="gray f28">{{item.processTime}}</view>

								<view class="textColor">{{item.processType | taskType}}</view>
								<view class="textColor" v-if="item.explan">说明：{{item.explan?item.explan:'无'}}</view>
								<view class="textColor" v-if="item.compRate">
									进度{{item.compRate?item.compRate+'%':'0.00%'}}</view>


							</view> -->
						</template>
					</u-time-line-item>

				</u-time-line>
				<view v-if="empty" style="position: fixed;top:40%;left:50%;transform: translateX(-50%);">
					<u-empty text="暂无历史"></u-empty>

				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		props: {
			title: {
				default: '付款历史'
			},
			taskId: {
				default: 0
			},
			type: {
				default: 1 //1主任务2子任务
			}
		},
		data() {
			return {
				head: this.$head,
				list: [],
				empty: false

			}
		},
		created() {
			this.getlist()
		},

		methods: {
			getlist() {
				if (this.type == 1) {
					this.$pop.ajaxPost('/bus/taskProcess/dealList', {
						taskId: this.taskId
					}).then(res => {
						this.list = res.body
						if (this.list.length == 0) {
							this.empty = true
						} else {
							this.empty = false
						}
					})
				} else {
					this.$pop.ajaxPost('/bus/taskProcess/dealList', {
						taskId: this.taskId
					}).then(res => {
						this.list = res.body
						if (this.list.length == 0) {
							this.empty = true
						} else {
							this.empty = false
						}
					})
				}

			}



		}
	}
</script>
